GitHub CardにするUserScript
全部選択しないと機能しないので注意
External Linkじゃないと起動しないのは,何かしら終端文字がないと選択時に常に発動し続けて出たり消えたりしてうるさいため
code:script.js
const githubRepoRegex = /\[https:\/\/github\.com\/(\w\-\_+\/\w\-\_+)\]/g scrapbox.PopupMenu.addButton({
title: text => githubRepoRegex.test(text) ? "GitHub Card" : null,
onClick: text => text.replace(
githubRepoRegex,
(_, repo) => [https://gh-card.dev/repos/${repo}.svg https://github.com/${repo}]
)
})